package leetcodecompetition.D349;

/**
 * @Author: Siantar
 * @Date: 2023-06-11-10:31
 * @Description: 1.0
 */
public class T6470 {
    public int findNonMinOrMax(int[] nums) {
        int min=nums[0];
        int max=nums[0];
        int mid=-1;
        for(int num:nums){
            if (num<min){
                int t=min;
                min=num;
                num=t;
            }
            if (num>max){
                int t=max;
                max=num;
                num=t;
            }
            if (num>min&&num<max){
                mid=num;
                break;
            }
        }
        return mid;
    }
}
